#region Copyright RenGuiYou. All rights reserved.
//=====================================================
// NeatlyFrameWork
// Author:      RenGuiyou
// Feedback: 	mailto:750539605@qq.com
//=====================================================
#endregion

using System;
using UnityEngine;
using UnityEngine.EventSystems;

public class NPointerClickListener : MonoBehaviour, IPointerClickHandler, IPointerDownHandler, IPointerUpHandler
{
    private Action m_OnClick;
    private Action m_OnPointerDown;
    private Action m_OnPointerUp;

    public void OnPointerClick(PointerEventData eventData)
    {
        if (m_OnClick != null)
        {
            m_OnClick();
        }
    }

    public void OnPointerDown(PointerEventData eventData)
    {
        if (m_OnPointerDown != null)
        {
            m_OnPointerDown();
        }
    }

    public void OnPointerUp(PointerEventData eventData)
    {
        if (m_OnPointerUp != null)
        {
            m_OnPointerUp();
        }
    }

    // --------------------------------------------------------------------------------------------
    // 扩展接口
    public void AddClick(Action action)
    {
        m_OnClick = action;
    }

    public void AddPointerDown(Action action)
    {
        m_OnPointerDown = action;
    }

    public void AddPointerUp(Action action)
    {
        m_OnPointerUp = action;
    }
}